package com.hnevc.caoliuye;

/**
 *
 * 陈勇去世纪联华买了一把伞
 * 人；买 超市；卖
 */
public class Example01 {

    public static void main(String[] args) {
        Product p1 = new Product();
        Product p2 = new Product();
        Product p3 = new Product();
        Product p4 = new Product();
        Product p5 = new Product();
        p1.setProName("冰箱");
        p2.setProName("洗衣机");
        p3.setProName("空调");
        p4.setProName("电风扇");
        p5.setProName("缝纫机");
        Market market = new Market();
        market.setMarketName("世纪联华");
        market.setProducts(new Product[]{p1,p2,p3,p4,p5});
        Person person = new Person();
        person.setName("陈勇");
        Product result = person.shopping(market,"空调");
        if(result == null){
            System.out.println(person.getName() +"白跑了" +
                    "一趟，在" + market.getMarketName() +"什么都没买到");
        }else{
            System.out.println(person.getName() +"在" + market.getMarketName()+""+
                    "买到了" + result.getProName());
        }



    }
}
